
#ifndef _READWRITE_NOS_H_
#define _READWRITE_NOS_H_

#include <BMap>
#include <BStream>
#include <BNode>
#include <BLight>
#include <BCamera>
#include <BScene>
#include <BMesh>
#include <BGeometry>

#include <BImage>
#include <BQuad>
#include <BPixmap>
#include <BMaterial>
#include <BTexture>
#include <BProgram>
#include <BShader>
#include <BUniform>

#include <BPiece>
#include <BFile>
#include <BReadWrite>

using namespace BWE;

struct QuadFace
{
	//void operator = (const QuadFace& other)
	//{
	//	ia = other.ia;
	//	ib = other.ib;
	//	ic = other.ic;
	//	id = other.id;
	//}
	int		ia;
	int		ib;
	int		ic;
	int		id;
};
struct PointCell
{
	BVector	vec;
	int		index;
};

class ReadWrite_step : public BReadWrite
{
public:
	ReadWrite_step();
	~ReadWrite_step();

	virtual void setOptions(const BString& options) override;
	virtual const BString& options() const override;

	virtual BObject* load(const BString& fileName) override;
	virtual bool load(const BString& fileName, BObject* object) override;
	virtual bool save(const BString& fileName, const BObject* object) const override;

	virtual BObject* read(const BBuffer& buffer) override;
	virtual bool read(const BBuffer& buffer, BObject* object) override;
	virtual bool write(BBuffer& buffer, const BObject* object) const override;

	virtual const BString& author() const;
	virtual const BString& version() const;
	virtual const BString& description() const;
	virtual const BString& message() const;

protected:
	bool readHeader(const BFile& file);
	bool readData(const BFile& file);

private:
	BString			_author;
	BString			_version;
	BString			_description;
	BString			_message;
	BString			_options;
	BString			_log;

	BMap<int, PointCell>	_pointMap;
	BMap<int, BVector>		_directionMap;
	BMap<int, BVector>		_vectorMap;
	BMap<int, BColor>		_colorMap;
	BMap<int, QuadFace>		_quadMap;
	BStringList				_edgeLoopTexts;
};

#endif